<template>
  <div :style="retStyle">
    <slot></slot>
  </div>
</template>

<script>
import json from '../../package.json'

export default {
  name: 'Space',
  props: ['height', 'w', 'item'],
  methods: {
    getRem(px) {
      return px / json.rootValue + 'rem'
    }
  },
  computed: {
    retStyle() {
      const res = {}
      const item = this.item ? this.item : {}
      if (item.height) {
        res.height = this.getRem(item.height)
      }

      if (item.width) {
        res.width = this.getRem(item.width)
      }

      return res
    }
  }
}
</script>

<style lang="scss" scoped>
</style>
